<template>
  <div id="app">
    This is app
    <!-- <parent :msgA="a" :msgB="b" :msgC="c"></parent>
    <button @click="passMsg">向son组件通过bus总线传递数据</button> -->
    <!-- <router-link to="/home">home</router-link> -->
    <!-- 编程式导航 -->
    <!-- <button @click="toHome">home</button> -->
    <router-view></router-view>
  </div>
</template>

<style>

</style>

<script>
import parent from './views/Parent'
import bus from './utils/bus'
export default {
  components:{
    parent,
    bus
  },
  methods: {
    passMsg(){
      bus.$emit('msg','I am from app by bus')
    },
    // 编程式路由导航 (函数式)
    toHome(){
      // this.$router.push({path:'/home', query:{name:'Jack'}})
      this.$router.push({name:'Home', params:{id: 3}})  //注意： params与 name搭配
    }
  },
  data() {
    return {
      a: 'msgA',
      b: 'msgB',
      c: 'msgC'
    }
  },
}
</script>
